package com.wk.pms.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wk.common.bean.Resp;
import com.wk.pms.entity.SkuImages;
import com.wk.pms.service.SkuImagesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/skuimages")
public class SkuImagesController {

    @Autowired
    private SkuImagesService skuImagesService;

    /**
     * 根据skuId查询对应的商品描述图片
     * @param skuId
     * @return
     */
    @GetMapping("{skuId}")
    public Resp<List<SkuImages>> queryBySkuId(@PathVariable(value = "skuId") Long skuId){
        return Resp.ok(skuImagesService.list(new QueryWrapper<SkuImages>().eq("sku_id",skuId)));
    }
}

